#pragma once
#include "Vector.h"
#include "Matrix.h"

namespace mini
{
	extern CVector3D crossProduct(const CVector3D& a, const CVector3D& b);
	extern CVector3D operator * (float fvalue, const CVector3D& v);
	extern void CalculateTangentBinormal(VertexFormatVTNTB& vertex0,
		VertexFormatVTNTB& vertex1,
		VertexFormatVTNTB& vertex2,
		CPoint3F& tangent, CPoint3F& binormal);
	extern void CalculateNormal(CPoint3F& tangent, CPoint3F& binormal, CPoint3F& normal);

	template <typename T>
	inline void Clamp(OUT T& out, IN T p1, IN T p2)
	{
		if (out < p1)
		{
			out = p1;
		}
		else if (out > p2)
		{
			out = p2;
		}
	}

	extern void MatrixTo(CMatrix* pInOut, const CPoint3F& pt);
}

